package com.core.controller;

import com.core.annotation.OperationLog;
import com.core.resp.AjaxResponse;
import com.core.service.LogoutService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.constraints.NotNull;

/**
 * @author : HUANG
 * @create : 2025/5/31 23:31
 * @function :
 */
@RestController
public class LogoutController {
    @Autowired
    private LogoutService logoutService;

    @PostMapping("/logout/{username}")
    @OperationLog(type = "logout", module = "auth", description = "用户退出登录: #username")
    public AjaxResponse logout(@PathVariable @NotNull String username) {
        logoutService.logout(username);
        return AjaxResponse.success(200, "退出登录", null);
    }
}
